/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * NewMapForm.java
 *
 * Created on Aug 18, 2011, 11:20:56 AM
 */
package designer.userinterface.forms;

import designer.RHD_StateManager;

/**
 *
 * @author timon
 */
public class NewMapForm extends javax.swing.JFrame {

    /** Creates new form NewMapForm */
    public NewMapForm() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        pnl_ConfigNew = new javax.swing.JPanel();
        lbl_Intro = new javax.swing.JLabel();
        lbl_Width = new javax.swing.JLabel();
        txt_Width = new javax.swing.JTextField();
        lbl_Height = new javax.swing.JLabel();
        txt_Height = new javax.swing.JTextField();
        btn_CreateMap = new javax.swing.JButton();
        btn_Cancel = new javax.swing.JButton();

        jLabel1.setText("jLabel1");

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("New Map");
        setAlwaysOnTop(true);
        setBackground(new java.awt.Color(232, 62, 78));

        pnl_ConfigNew.setBackground(new java.awt.Color(248, 247, 246));
        pnl_ConfigNew.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        lbl_Intro.setFont(new java.awt.Font("Droid Sans", 1, 18)); // NOI18N
        lbl_Intro.setText("Create A New Map");

        lbl_Width.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        lbl_Width.setText("Width");

        lbl_Height.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        lbl_Height.setText("Height");

        btn_CreateMap.setText("Create Map");
        btn_CreateMap.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_CreateMapActionPerformed(evt);
            }
        });

        btn_Cancel.setBackground(new java.awt.Color(213, 29, 29));
        btn_Cancel.setText("Cancel");
        btn_Cancel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_CancelActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout pnl_ConfigNewLayout = new javax.swing.GroupLayout(pnl_ConfigNew);
        pnl_ConfigNew.setLayout(pnl_ConfigNewLayout);
        pnl_ConfigNewLayout.setHorizontalGroup(
            pnl_ConfigNewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnl_ConfigNewLayout.createSequentialGroup()
                .addGroup(pnl_ConfigNewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnl_ConfigNewLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(lbl_Intro))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnl_ConfigNewLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(btn_Cancel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 62, Short.MAX_VALUE)
                        .addComponent(btn_CreateMap))
                    .addGroup(pnl_ConfigNewLayout.createSequentialGroup()
                        .addGap(20, 20, 20)
                        .addGroup(pnl_ConfigNewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(lbl_Height)
                            .addComponent(lbl_Width))
                        .addGap(18, 18, 18)
                        .addGroup(pnl_ConfigNewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txt_Width, javax.swing.GroupLayout.DEFAULT_SIZE, 138, Short.MAX_VALUE)
                            .addComponent(txt_Height, javax.swing.GroupLayout.DEFAULT_SIZE, 138, Short.MAX_VALUE))))
                .addContainerGap())
        );
        pnl_ConfigNewLayout.setVerticalGroup(
            pnl_ConfigNewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnl_ConfigNewLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(lbl_Intro)
                .addGap(18, 18, 18)
                .addGroup(pnl_ConfigNewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lbl_Width)
                    .addComponent(txt_Width, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnl_ConfigNewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lbl_Height)
                    .addComponent(txt_Height, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(pnl_ConfigNewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btn_CreateMap, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btn_Cancel, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pnl_ConfigNew, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pnl_ConfigNew, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
     * Convert user input to integers and call for the dimensions of the 
     * map in memory to be updated with those values.
     * 
     * @param evt 
     *   The object representing the action event.
     */
    private void btn_CreateMapActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_CreateMapActionPerformed

        this.setVisible(false); 
        
        /**
         * @TODO:  Validate user inputs for Map Creation form.
         */
    }//GEN-LAST:event_btn_CreateMapActionPerformed

    private void btn_CancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_CancelActionPerformed
        
        // Void out values of textboxes so the object reports null (indicating
        // cancellation).
        txt_Width.setText("CANCEL");
        txt_Height.setText("CANCEL");
        
        this.setVisible(false);
    }//GEN-LAST:event_btn_CancelActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new NewMapForm().setVisible(true);
            }
        });
    }
    
    /**
     * Get the string value of the text in the Width entry box.
     * 
     * @return 
     *   The new width value, entered by the user
     */
    public String getDungeonWidth() {
        return txt_Width.getText();
    }
    
    /**
     * Get the string value of the text in the Height entry box.
     * 
     * @return 
     *   The new height value, entered by the user
     */
    public String getDungeonHeight() {
        return txt_Height.getText();
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btn_Cancel;
    private javax.swing.JButton btn_CreateMap;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel lbl_Height;
    private javax.swing.JLabel lbl_Intro;
    private javax.swing.JLabel lbl_Width;
    private javax.swing.JPanel pnl_ConfigNew;
    private javax.swing.JTextField txt_Height;
    private javax.swing.JTextField txt_Width;
    // End of variables declaration//GEN-END:variables
}
